package com.zxw.service.impl;


import com.aaa.entity.GGoods;
import com.aaa.vo.GoodsNumVo;
import com.aaa.vo.GoodsVo;
import com.aaa.vo.Result;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zxw.dao.GGoodsMapper;
import com.zxw.service.GGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 86176
* @description 针对表【g_goods(商品表)】的数据库操作Service实现
* @createDate 2023-02-27 10:27:55
*/
@Service
@SuppressWarnings("all")
public class GGoodsServiceImpl extends ServiceImpl<GGoodsMapper, GGoods>
    implements GGoodsService {

    @Autowired
    private GGoodsMapper goodsMapper;
    @Override
    public Result findAllGoods(GoodsVo goodsVo, Integer pageCurrent, Integer pageSize) {
        PageHelper.startPage(pageCurrent, pageSize);
        List<GGoods> allGoods = goodsMapper.findAllGoods(goodsVo.getGname(), goodsVo.getBid(), goodsVo.getSortid(), goodsVo.getState());
        PageInfo<GGoods> pageInfo = new PageInfo<>(allGoods);
        return new Result(2000,"查询成功",pageInfo);
    }

    @Override
    public Result updateGoods(GGoods goods) {
        goodsMapper.updateById(goods);
        return new Result<>(2000,"修改成功");
    }

//    @Override
//    public Result findGoodsAndNumByBid(String bid) {
//        List<GoodsNumVo> goodsAndNumByBid = goodsMapper.findGoodsAndNumByBid(bid);
//        return new Result(2000,"查询成功",goodsAndNumByBid);
//    }
}




